package com.coffeeloversupportlibrary.coffeelover.domain.article.manger;

import android.view.View;

import github.hellocsl.layoutmanager.gallery.GalleryLayoutManager;

/**
 * @author puyv
 * @createTime 2021/11/6 20:31
 * @projectName CoffeeLoverSupportLibrary
 * @className ScaleTransformer.java
 * @description TODO
 */
public class ScaleTransformer implements GalleryLayoutManager.ItemTransformer {

    @Override
    public void transformItem(GalleryLayoutManager layoutManager, View item, float fraction) {
        item.setPivotX(item.getWidth() / 2.F);
        item.setPivotY(item.getHeight() / 2.F);
        float scale = 1 - 0.3F * Math.abs(fraction);
        item.setScaleX(scale);
        item.setScaleY(scale);
    }
}
